﻿using System;
using System.Globalization;
using System.Windows.Data;
using YKXiangQi.Enums;

namespace YKXiangQi.Converters
{
    public class PieceOpacityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var state = (PieceState) value;
            switch (state)
            {
                case PieceState.LastMove:
                    return 0.5;
                case PieceState.Selected:
                    return 1;
                case PieceState.Normal:
                default:
                    return 0;
            }
        }

        public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new System.NotImplementedException();
        }
    }
}
